home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8491 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.4 KB

  1. Path: news.its.com!usenet
  2. From: mastbrook@duff.com (Bill Mastbrook)
  3. Newsgroups: comp.lang.basic.visual.misc,comp.lang.c,comp.os.ms-windows.programmer.controls,comp.os.ms-windows.programmer.misc
  4. Subject: Re: Multiple instances of a VBX
  5. Date: Mon, 04 Mar 1996 18:42:37 GMT
  6. Organization: Information Technology Solutions, Inc.
  7. Message-ID: <4hfdob$677@news.its.com>
  8. References: <4g0efd$1mb@news.its.com> <4gv17p$lc8@zebedee.ingres.co.uk>
  9. NNTP-Posting-Host: duff230.duff.com
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. jonm@ingres.com (Jon Machtynger) wrote:
  13.  
  14. >>When multiple instances of a control are created, the same HCTL value
  15. >>is always passed to the main control procedure for all messages.  The
  16. >>HCTL value is used to generate events with the VBFireEvent function.
  17. >>So, without a unique HCTL value, how do I generate the events in the
  18. >>correct instance of the control?  
  19.  
  20. >This doesn't sound right.  You should be able to use a combination
  21. >of the htcl and the hwnd to determine exactly which control and window
  22. >you are using.  In other words, the htcl is a unique identifier.
  23.  
  24. Inside the main control proc, I put a print statement that printed the
  25. hctl and hwnd values to a file, each time into the proc.  I then
  26. started up multiple instances of a program that uses the VBX.  The
  27. hctl values printed to the file never change, no matter which instance
  28. of the control is currently active.  However, the hwnd values do
  29. change.  So, even though I have a unique hwnd, because the hctl is the
  30. same, all events fired with VBFireEvent go to the same instance of the
  31. control.  Right?
  32.  
  33. What am I doing wrong?  
  34.  
  35. The above problem may not even be important if what I describe below
  36. is not possible.  Here's what I'm trying to do ...
  37.  
  38. I use the VBX to call an api (3rd party) that requests info from a
  39. remote server.  The api calls take a pointer to a function that is
  40. called when the info is returned from the server.  When this function
  41. is called by the api, I need to generate an event telling the calling
  42. VB program that the info was returned and pass the info to the VB
  43. program.  Because the function called by the api doesn't contain the
  44. hctl or hwnd value of the control, how can I generate events in the
  45. correct instance of the VBX from this function?  Is it possible
  46. without changing the api to accomodate the handle in both the function
  47. called to request the information and the function called by the api
  48. to return the information?
  49.  
  50. Any suggestions will be greatly appreciated.
  51.  
  52. Thanks,
  53. Bill
  54.  
  55.  
  56.